//
//  WorkHomeVC.m
//  XLDoctor
//
//  Created by longma on 2018/7/27.
//  Copyright © 2018年 XLH. All rights reserved.
//

#import "DetectionPeriodtAlertView.h"
#import "NotesGuideVC.h"

static const CGFloat contentHeight = 300.0f;

@interface DetectionPeriodtAlertView ()

@property (weak, nonatomic) IBOutlet NSLayoutConstraint *contentviewH;
@property (weak, nonatomic) IBOutlet UIView *contentview;
@property (weak, nonatomic) IBOutlet MJUIAlertVCBaseView *baseAlertView;
@property (weak, nonatomic) IBOutlet MJUIPickerItemAlertTopView *viewTop;
@property (weak, nonatomic) IBOutlet UIStackView *howDetectionStackView;

@end

@implementation DetectionPeriodtAlertView
#pragma mark - 系统

- (void)viewDidLoad {
    [super viewDidLoad];

    self.contentviewH.constant = contentHeight;
    self.baseAlertView.alertType = AlertTypeBottom;
    self.baseAlertView.contentHeight = contentHeight;
    [self.baseAlertView initContentview:self.contentview];

    MJWeakSelf
    self.viewTop.contentView.backgroundColor = UIColor.whiteColor;
    self.viewTop.titleLabel.mj_localizable = @"Select Period";
    self.viewTop.titleLabelLeft.constant = 20;
    [self.viewTop.cancelButton mj_addAction:^(UIButton *button) {
        
        if(weakSelf.isGlobalDetection){
            [HealthHelper interruptionSaveAlertViewWithConfirmBlock:^{
                [weakSelf.baseAlertView dismiss];
            } cancelBlock:^{}];
        }else{
            [weakSelf.baseAlertView dismiss];
        }
    }];
    
    [self.howDetectionStackView mj_addTapActionWithBlock:^{
        NotesGuideVC *vc = [[NotesGuideVC alloc]init];
        weakSelf.modalPresentationStyle = UIModalPresentationCurrentContext;
        [[UIViewController mj_topViewController].navigationController pushViewController:vc animated:true];
    }];
    
}

- (void)viewWillAppear:(BOOL)animated{
    [super viewWillAppear:animated];
    
}

- (void)viewWillDisappear:(BOOL)animated{
    [super viewWillDisappear:animated];
 
}

- (IBAction)handlePeriodButtonButtonEvent:(UIButton *)sender {

    MJWeakSelf
    [self.baseAlertView dismissCompletion:^{
        if(weakSelf.confirmBlock){
            weakSelf.confirmBlock(sender.tag == 0 ? @"Fasting":@"Postprandial");//Postprandial AfterMeal
        }
    }];
}


#pragma mark - 其他



@end
